from django.http import HttpResponse
from rest_framework import viewsets

from appBackend.models import LPRRecords
from appBackend.serializers import LPRRecordsSerializer
from appBackend.utils import LPRUtils


class LPRRecordsViewSet(viewsets.ModelViewSet):
    queryset = LPRRecords.objects.all()
    serializer_class = LPRRecordsSerializer

def get_newest_lpr(request):
    """
    获取最新的LPR数据，定期执行更新的
    """
    LPRUtils.get_newest_lpr()
    return HttpResponse({"status": "ok"})

